package com.wei.czz.common.dto.store.audit;

import com.wei.czz.common.enums.store.StoreSubmitTypeEnum;
import com.wei.czz.common.tool.BaseEntity;
import com.wei.czz.framework.store.entity.AuditStoreEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wyw
 * date: 2023-12-14 15:27:03
 * className: AuditStoreDto
 * version: 1.0
 * description:
 */
@Getter
@Setter
@Accessors(chain = true)
public class AuditStoreDto extends BaseEntity {

    /**
     * 主键
     */
    private String id;

    /**
     * 用户主键
     */
    private String userId;

    /**
     * 商店主键
     */
    private String storeId;

    /**
     * 业务主键
     */
    private String businessId;

    /**
     * 商店账户主键
     */
    private String accountId;

    /**
     * 商店老板主键
     */
    private String bossId;

    /**
     * 审核类型
     */
    private Integer type;

    /**
     * 审核类型名称
     */
    private String typeName;

    /**
     * 审核结果[0-通过 1-拒绝]
     */
    private Integer status;

    /**
     * 审核备注
     */
    private String auditRemark;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 创建用户
     */
    private String createUser;

    /**
     * 商店审核记录封装
     * @param auditStore 商店审核记录对象
     * @return 封装结果
     */
    public static AuditStoreDto map(AuditStoreEntity auditStore) {
        AuditStoreDto auditStoreDto = new AuditStoreDto();
        auditStoreDto.setId(auditStore.getId().toString())
                .setUserId(auditStore.getUserId().toString())
                .setStoreId(auditStore.getStoreId().toString())
                .setBusinessId(auditStore.getBusinessId().toString())
                .setAccountId(auditStore.getAccountId().toString())
                .setBossId(auditStore.getBossId().toString())
                .setType(auditStore.getType())
                .setTypeName(StoreSubmitTypeEnum.getName(auditStore.getType()))
                .setStatus(auditStore.getStatus())
                .setAuditRemark(auditStore.getAuditRemark())
                .setCreateTime(auditStore.getCreateTime())
                .setCreateUser(auditStore.getCreateUser());
        return auditStoreDto;
    }
}
